<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp">



    <head>

    </head>

    <body>
        <ui:composition template="/resources/template/template.xhtml">
            <ui:define name="content">
                <h:outputStylesheet library="css" name="lab.css" ></h:outputStylesheet>
                <div class="nonPrintBlock">
                    <h:form id="form">

                        <h:panelGroup rendered="#{webUserController.hasPrivilege('LabAutherizing') eq true or webUserController.hasPrivilege('LabDataentry') eq true or webUserController.hasPrivilege('LabPrinting') eq true   }" styleClass="nonPrintBlock">
                            <p:growl id="messages" showDetail="true"/> 
                            <p:panel  >
                                <f:facet  name="header" >
                                    <h:panelGroup id="facetPanelIx" >
                                        <b><h:outputLabel value="#{patientReportController.currentPatientReport.item.reportedAs.name}" ></h:outputLabel></b>
                                        <h:outputLabel value=" - " ></h:outputLabel>
                                        <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.nameWithTitle}" ></h:outputLabel>
                                        <h:outputLabel value=", " ></h:outputLabel>
                                        <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.patient.age}" ></h:outputLabel>
                                        <h:outputLabel value=", " ></h:outputLabel>
                                        <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.sex}" ></h:outputLabel>

                                    </h:panelGroup>
                                </f:facet>

                                <p:tooltip for="facetPanelIx" >
                                    <p:panel header="Patient Details" styleClass="alignTop" >
                                        <p:panelGrid columns="2" >
                                            <h:outputLabel value="Name" ></h:outputLabel>
                                            <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.nameWithTitle}" ></h:outputLabel>
                                            <h:outputLabel value="Age" ></h:outputLabel>
                                            <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.patient.age}" ></h:outputLabel>
                                            <h:outputLabel value="Sex" ></h:outputLabel>
                                            <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.patient.person.sex}" ></h:outputLabel>
                                            <h:outputLabel value="Investigation" ></h:outputLabel>
                                            <h:outputLabel value="#{patientReportController.currentPatientReport.item.reportedAs.name}" ></h:outputLabel>
                                        </p:panelGrid>
                                    </p:panel>

                                </p:tooltip>

                                <h:panelGrid columns="2" >
                                    <p:outputLabel value="Report Format" ></p:outputLabel>
                                    <p:selectOneMenu  id="mnuCat" value="#{patientReportController.currentPatientReport.reportFormat}"  style="width: 300px!important;">
                                        <f:selectItems  value="#{reportFormatController.items}" var="myItem" itemValue="#{myItem}" itemLabel="#{myItem.name}" ></f:selectItems>
                                        <f:ajax event="change" execute="mnuCat" render=":#{p:component('divPrint')}" />
                                    </p:selectOneMenu>
                                </h:panelGrid>
                                <h:panelGrid columns="9" >
                                    <p:commandButton rendered="#{webUserController.hasPrivilege('LabDataentry') eq true and patientReportController.currentPatientReport.approved ne true}"  
                                                     value="Save" 
                                                     action="#{patientReportController.savePatientReport()}" ajax="false" onclick="onSubmitButton();"  >
                                    </p:commandButton>
                                    <p:commandButton ajax="false" process="tblVals" update=":#{p:component('tblCals')} :#{p:component('tblFlags')} :#{p:component('divPrint')}"  styleClass="nonPrintBlock"  value="Calculate" 
                                                     action="#{patientReportController.calculate}" onclick="onSubmitButton();"   >
                                    </p:commandButton>

                                    <p:commandButton styleClass="nonPrintBlock"  id="btnApprove"  disabled ="#{!(webUserController.hasPrivilege('LabAutherizing') eq true and patientReportController.currentPatientReport.dataEntered eq true)}"   
                                                     value="Approve" action="#{patientReportController.approvePatientReport()}" ajax="false" onclick="onSubmitButton();"  >
                                    </p:commandButton>

                                    <p:commandButton styleClass="nonPrintBlock"  id="btnCancel"  disabled ="#{!(webUserController.hasPrivilege('LabDeAutherizing') eq true and patientReportController.currentPatientReport.approved eq true)}"   value="Cancel Approval" 
                                                     action="#{patientReportController.reverseApprovalOfPatientReport()}" ajax="false" onclick="onSubmitButton();"  >
                                    </p:commandButton>

                                    <!--                                    <p:commandButton styleClass="nonPrintBlock"  
                                                                                         ajax="false" 
                                                                                         value="Print" 
                                                                                         rendered="#{patientReportController.currentPatientReport.approved or userPreferenceController.userPreference.canPrintWithoutPermission}"
                                                                                         onclick="window.print();" 
                                                                                         actionListener="#{patientReportController.printPatientReport()}"/>-->

                                    <p:spacer width="30" ></p:spacer>
                                    <p:commandButton  styleClass="nonPrintBlock"  value="Patient Report Search" action="#{patientReportController.patientReportSearch}" ajax="false" >
                                    </p:commandButton>
                                    <p:commandButton  styleClass="nonPrintBlock"  value="Report Search" action="/lab/search_for_reporting_ondemand" ajax="false" onclick="onSubmitButton();"  >
                                    </p:commandButton>
                                    <p:commandButton  styleClass="nonPrintBlock"  value="To Approve List" action="#{searchController.listReportsAwaitingApproval()}" ajax="false" onclick="onSubmitButton();"  >
                                    </p:commandButton>

                                    <p:commandButton styleClass="nonPrintBlock" ajax="false" value="Back to Visit" action="/clinical/clinical_new_opd_visit.xhtml" style="float: right;" onclick="onSubmitButton();" ></p:commandButton>

                                </h:panelGrid>


                                <h:panelGrid columns="3" styleClass="alignTop" >
                                    <p:panel header="Enter Values"  
                                             rendered="#{patientReportController.currentPatientReport.transInvestigation.reportType ne 'Microbiology' and patientReportController.currentPatientReport.containValues eq true}" >
                                        <table >
                                            <ui:repeat id="tblVals" value="#{patientReportController.currentPatientReport.patientReportItemValues}"  
                                                       var="pvv"  
                                                       >
                                                <h:panelGroup rendered="#{pvv.investigationItem.ixItemType eq 'Value'}"  >
                                                    <tr>
                                                        <td style="min-width: 200px!important;">
                                                            <h:outputLabel value="#{pvv.investigationItem.name}"></h:outputLabel>
                                                        </td>
                                                        <td >
                                                            <p:inputText autocomplete="off" value="#{pvv.strValue}" disabled="#{patientReportController.currentPatientReport.approved}"
                                                                         rendered="#{pvv.investigationItem.ixItemValueType eq 'Varchar' and empty pvv.investigationItem.investigationItemValues}" >
                                                                <p:ajax process="@this" event="blur" listener="#{patientReportController.savePatientReportItemValues()}"></p:ajax>
                                                            </p:inputText>
                                                            <p:selectOneMenu value="#{pvv.strValue}" disabled="#{patientReportController.currentPatientReport.approved}"
                                                                             rendered="#{pvv.investigationItem.ixItemValueType eq 'Varchar' and !empty pvv.investigationItem.investigationItemValues}" 
                                                                             editable="true"  style="min-width: 300px!important;" >
                                                                <f:selectItems value="#{pvv.investigationItem.investigationItemValues}" var="iiv" itemLabel="#{iiv.name}" itemValue="#{iiv.name}" ></f:selectItems>
                                                                <p:ajax process="@this" event="change" listener="#{patientReportController.savePatientReportItemValues()}"></p:ajax>
                                                            </p:selectOneMenu>
                                                            <p:inputText id="txtValDbl" autocomplete="off" value="#{pvv.doubleValue}" validatorMessage="Entered value not valid. Please recheck." converterMessage="Entered value not valid. Please recheck."
                                                                         rendered="#{pvv.investigationItem.ixItemValueType eq 'Double'}" disabled="#{patientReportController.currentPatientReport.approved}">
                                                                <p:ajax process="@this" event="blur" listener="#{patientReportController.savePatientReportItemValues()}"></p:ajax>
                                                            </p:inputText>
                                                            <p:inputTextarea  value="#{pvv.lobValue}" queryDelay="0" disabled="#{patientReportController.currentPatientReport.approved}"
                                                                              rendered="#{pvv.investigationItem.ixItemValueType eq 'Memo'}" >
                                                                <p:ajax process="@this" event="blur" listener="#{patientReportController.savePatientReportItemValues()}"></p:ajax>
                                                            </p:inputTextarea>
                                                        </td>
                                                    </tr>
                                                </h:panelGroup>
                                            </ui:repeat>
                                        </table>
                                    </p:panel>
                                    <h:panelGroup  
                                        rendered="#{patientReportController.currentPatientReport.transInvestigation.reportType ne 'Microbiology'  and patientReportController.currentPatientReport.containCalculations eq true }"   >
                                        <p:panel header="Calculations " id="tblCals">
                                            <table >               
                                                <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" 
                                                            var="pvcal"  

                                                            >

                                                    <h:panelGroup   rendered="#{pvcal.investigationItem.ixItemType eq 'Calculation'}"   >
                                                        <tr>
                                                            <td>
                                                                <h:outputLabel value="#{pvcal.investigationItem.name}" ></h:outputLabel>
                                                            </td>
                                                            <td >
                                                                <h:inputText autocomplete="off" value="#{pvcal.strValue}" disabled="#{patientReportController.currentPatientReport.approved}"
                                                                             rendered="#{pvcal.investigationItem.ixItemValueType eq 'Varchar'}" >
                                                                    <f:ajax execute="@this" event="blur" listener="#{patientReportController.savePatientReportItemValues()}"></f:ajax>
                                                                </h:inputText>
                                                                <p:inputText autocomplete="off" value="#{pvcal.doubleValue}" disabled="#{patientReportController.currentPatientReport.approved}"
                                                                             rendered="#{pvcal.investigationItem.ixItemValueType eq 'Double'}" >
                                                                    <f:convertNumber pattern="0.0" ></f:convertNumber>
                                                                    <f:ajax execute="@this" event="blur" listener="#{patientReportController.savePatientReportItemValues()}"></f:ajax>
                                                                </p:inputText>
                                                            </td>
                                                        </tr>
                                                    </h:panelGroup>
                                                </ui:repeat>
                                            </table>
                                        </p:panel>

                                    </h:panelGroup>
                                    <p:panel header="Flags" id="tblFlags"
                                             rendered="#{patientReportController.currentPatientReport.transInvestigation.reportType ne 'Microbiology'  and patientReportController.currentPatientReport.containFlags eq true}" 
                                             >
                                        <table >
                                            <ui:repeat  
                                                value="#{patientReportController.currentPatientReport.patientReportItemValues}" 
                                                var="pvf" 
                                                >
                                                <h:panelGroup rendered="#{pvf.investigationItem.ixItemType eq 'Flag'}" >
                                                    <tr>
                                                        <td >
                                                            <h:outputLabel value="#{pvf.investigationItem.name}" ></h:outputLabel>
                                                        </td>
                                                        <td>
                                                            <p:selectOneMenu id="cmbStrFlag" value="#{pvf.strValue}" editable="true" style="min-width: 200px;" disabled="#{patientReportController.currentPatientReport.approved}">
                                                                <f:selectItems value="#{testFlagController.getIxItemFlagsString(pvf.investigationItem)}" var="iivfh" itemLabel="#{iivfh}" itemValue="#{iivfh}" ></f:selectItems>
                                                            </p:selectOneMenu>
                                                        </td>
                                                    </tr>
                                                </h:panelGroup>
                                            </ui:repeat>
                                        </table>
                                    </p:panel>
                                    <p:panel header="Dynamic Labels" rendered="#{patientReportController.currentPatientReport.containDynamicLabels eq true }"  >
                                        <table >
                                            <ui:repeat id="tblDls" 
                                                       value="#{patientReportController.currentPatientReport.patientReportItemValues}"  
                                                       var="pvd"  >
                                                <h:panelGroup rendered="#{pvd.investigationItem.ixItemType eq 'DynamicLabel'}" >
                                                    <tr>
                                                        <td >
                                                            <h:outputLabel value="#{pvd.investigationItem.name}" ></h:outputLabel>
                                                        </td>
                                                        <td>
                                                            <p:selectOneMenu  id="cmbStrDl" value="#{pvd.strValue}" editable="true" style="min-width: 200px;" disabled="#{patientReportController.currentPatientReport.approved}">
                                                                <f:selectItems value="#{investigationItemDynamicLabelController.getDynamicLabelsByIxItId(pvd.investigationItem) }" var="iivd" itemLabel="#{iivd.flagMessage}" itemValue="#{iivd}" ></f:selectItems>
                                                                <p:ajax process="@this" event="change" listener="#{patientReportController.savePatientReportItemValues()}"></p:ajax>
                                                            </p:selectOneMenu>
                                                        </td>
                                                    </tr>
                                                </h:panelGroup>
                                            </ui:repeat>
                                        </table>
                                    </p:panel>
                                    <p:panel header="Microbiology"    rendered="#{patientReportController.currentPatientReport.transInvestigation.reportType eq 'Microbiology'}" >
                                        <f:view contentType="text/html">
                                            <table >
                                                <ui:repeat id="tblMicVals" 
                                                           value="#{patientReportController.currentPatientReport.patientReportItemValues }"  
                                                           var="pvm"   
                                                           >
                                                    <h:panelGroup rendered="#{pvm.investigationItem.ixItemType eq 'Value' or pvm.investigationItem.ixItemType eq 'Antibiotic' }" >
                                                        <tr>
                                                            <td >
                                                                <h:outputLabel value="#{pvm.investigationItem.name}" ></h:outputLabel>
                                                            </td>
                                                            <td >

                                                                <h:panelGroup rendered="#{pvm.investigationItem.ixItemValueType eq 'Memo'}" >
                                                                    <p:inputTextarea rendered="true" id="txtMicMemoVal" queryDelay="0"   minQueryLength="1"  style="min-width: 200px; "  
                                                                                     completeMethod="#{investigationItemValueController.completeValues}" disabled="#{patientReportController.currentPatientReport.approved}"
                                                                                     value="#{pvm.lobValue}" >
                                                                        <p:ajax process="@this" event="blur" listener="#{patientReportController.savePatientReportItemValues()}"></p:ajax>
                                                                    </p:inputTextarea>
                                                                </h:panelGroup>
                                                                <h:panelGroup rendered="#{pvm.investigationItem.ixItemValueType eq 'Varchar'}">
                                                                    <p:selectOneMenu id="cmbMicStrVal" value="#{pvm.strValue}" editable="true"  style="min-width: 300px!important;" disabled="#{patientReportController.currentPatientReport.approved}">
                                                                        <f:selectItem itemLabel="SENSITIVE" itemValue="SENSITIVE" ></f:selectItem>
                                                                        <f:selectItem itemLabel="RESISTANT" itemValue="Resistant" ></f:selectItem>
                                                                        <f:selectItem itemLabel="INTERMEDIATE" itemValue="Intermediate" ></f:selectItem>
                                                                        <f:ajax event="change"  execute="@this" 
                                                                                listener="#{patientReportController.savePatientReportItemValues()}" ></f:ajax>
                                                                    </p:selectOneMenu>
                                                                </h:panelGroup>

                                                            </td>
                                                        </tr>
                                                    </h:panelGroup>
                                                </ui:repeat>
                                            </table>
                                        </f:view>

                                    </p:panel>
                                    <p:panel header="Report"    
                                             rendered="#{patientReportController.currentPatientReport.transInvestigation.reportType eq 'PathologyOrHaematology'}" >


                                        <h:panelGrid columns="4" >
                                            <p:outputLabel value="Search a Template" ></p:outputLabel>
                                            <p:autoComplete id="acTemplate" 
                                                            value="#{patientReportController.investigationItem}" 
                                                            completeMethod="#{investigationItemController.completeTemplate}"
                                                            var="ii" itemLabel="#{ii.name}" itemValue="#{ii}" >
                                                <p:ajax event="itemSelect" process="@this" ></p:ajax>
                                            </p:autoComplete>
                                            <p:commandButton id="btnAddPathReport"
                                                             oncomplete="PF('dlgPath').show();" 
                                                             process="acTemplate btnAddPathReport" update="dlgPath" 
                                                             value="Add Template to Report" actionListener="#{patientReportController.toAddNewTemplate()}" ></p:commandButton>
                                            <p:commandButton value="Edit Selected Template" ajax="false" action="#{patientReportController.toEditTemplate()}" >
                                            </p:commandButton>
                                            <p:dialog id="dlgPath" header="Pathology Report" widgetVar="dlgPath" modal="true">
                                                <h1>#{patientReportController.investigationItem}</h1>
                                                <h:panelGroup rendered="#{patientReportController.investigationItem eq null}" >
                                                    <p:outputLabel value="Please select a template first" ></p:outputLabel>
                                                    <p:commandButton id="btnCloseGlg1"
                                                                     oncomplete="PF('dlgPath').hide();" 
                                                                     process="@this dlgPath" update="reportEditor" 
                                                                     value="Close"></p:commandButton>
                                                </h:panelGroup>
                                                <h:panelGroup rendered="#{patientReportController.investigationItem ne null}" >
                                                    <p:commandButton id="btnAddTemplateToReport"
                                                                     oncomplete="PF('dlgPath').hide();" 
                                                                     process="@this dlgPath" update="reportEditor" 
                                                                     value="Add To Report" 
                                                                     actionListener="#{patientReportController.addTemplateToReport()}" ></p:commandButton>
                                                    <table >
                                                        <tr>
                                                            <th>
                                                                <p:outputLabel value="Variable" ></p:outputLabel>
                                                            </th>
                                                            <th>
                                                                <p:outputLabel value="Value" ></p:outputLabel>
                                                            </th>
                                                        </tr>

                                                        <ui:repeat value="#{patientReportController.selectables}" var="sel" >
                                                            <tr>
                                                                <td>
                                                                    <p:outputLabel value="#{sel.name}" ></p:outputLabel>
                                                                </td>
                                                                <td>
                                                                    <h:panelGroup >
                                                                        <p:inputText value="#{sel.selectedValue}" rendered="#{sel.inputText}" ></p:inputText>
                                                                        <p:selectOneMenu  value="#{sel.selectedValue}" rendered="#{sel.selectOneMenu}" >
                                                                            <f:selectItems value="#{sel.options}" ></f:selectItems>
                                                                        </p:selectOneMenu>
                                                                    </h:panelGroup>
                                                                </td>
                                                            </tr>
                                                        </ui:repeat>
                                                    </table>
                                                </h:panelGroup>





                                            </p:dialog>

                                        </h:panelGrid>
                                        <p:panel id="reportEditor" >
                                            <h:panelGroup rendered="false" >
                                                <h1>A</h1>
                                                #{patientReportController.currentPatientReport}
                                                <h1>B</h1>
                                                <ui:repeat value="#{patientReportController.currentPatientReport.patientReportItemValues}"
                                                           var="e" >
                                                    #{e.investigationItem.ixItemType}
                                                </ui:repeat>
                                                <h1>C</h1>
                                                #{patientReportController.currentPatientReport.templateItem.lobValue}
                                                <h1>D</h1>
                                                <h1>E</h1>
                                            </h:panelGroup>
                                            <p:editor rendered="#{patientReportController.currentPatientReport.templateItem ne null}" 
                                                      value="#{patientReportController.currentPatientReport.templateItem.lobValue}" widgetVar="editor" height="650" >

                                            </p:editor>
                                        </p:panel>

                                    </p:panel>

                                </h:panelGrid>


                            </p:panel>



                        </h:panelGroup>



                    </h:form>



                </div>

                <div >
                    <h:form >

                        <div class="nonPrintBlock" >
                            <h:panelGroup rendered="false" >
                                <p:commandButton  styleClass="nonPrintBlock"  ajax="false" value="Print" onclick="window.print();" actionListener="#{patientReportController.printPatientReport()}" 
                                                  rendered="#{patientReportController.currentPatientReport.approved or userPreferenceController.userPreference.canPrintWithoutPermission }" />


                            </h:panelGroup>
                            <h:panelGrid columns="3" >
                                <p:commandButton value="Print" ajax="false" actionListener="#{patientReportController.printPatientReport()}"
                                                 rendered="#{patientReportController.currentPatientReport.approved or userPreferenceController.userPreference.canPrintWithoutPermission }" >
                                    <p:printer target="divPrint" ></p:printer>
                                </p:commandButton>


                                <p:commandButton  styleClass="nonPrintBlock"  ajax="false" value="PDF" action="#{patientReportController.createPDFAndSaveAsaFile()}" 
                                                  rendered="#{(patientReportController.currentPatientReport.approved or userPreferenceController.userPreference.canPrintWithoutPermission)}" />
                            </h:panelGrid>

                        </div>



                        <h:panelGroup  id="divPrint" >

                            <h:panelGroup rendered="#{patientReportController.currentPatientReport.item.reportType ne 'Microbiology'}"  >
                                <div id="divReport"  class="labReport" >
                                    <ez:common_report commonReportFormat="#{patientReportController.currentPatientReport.reportFormat}"
                                                      patientReport="#{patientReportController.currentPatientReport}"/>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.lobValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false}"  escape="false" />
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.lobValue}" rendered="#{prv.investigationItem.ixItemType eq 'Template' and prv.investigationItem.retired eq false}"  escape="false" />
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Varchar'}" escape="false" />
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.doubleValue}"  rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Double' and prv.investigationItem.retired eq false}"   escape="false" />
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'DynamicLabel'}" escape="false" />
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Flag'}" escape="false" />
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                        <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                            <h:outputLabel value="#{prv.doubleValue}" rendered="#{prv.investigationItem.ixItemType eq 'Calculation' }" escape="false" >
                                                <f:convertNumber pattern="0.0" />
                                            </h:outputLabel>
                                        </div>
                                    </ui:repeat>
                                    <ui:repeat value="#{patientReportController.currentPatientReport.item.reportItems}" var="myIi" >
                                        <div style="#{myIi.cssStyle}; position:absolute;">
                                            <h:outputText rendered="#{myIi.retired ne true and myIi.ixItemType eq 'Label' }" value="#{myIi.htmltext}" style="color: #{myIi.cssColor}" escape="false" ></h:outputText>
                                        </div>
                                    </ui:repeat>
                                </div>
                            </h:panelGroup>
                            <h:panelGroup rendered="#{patientReportController.currentPatientReport.item.reportType eq 'Microbiology'}"  >
                                <div id="divReportM"   class="labReport" >
                                    <ez:common_report commonReportFormat="#{patientReportController.currentPatientReport.reportFormat}"
                                                      patientReport="#{patientReportController.currentPatientReport}"/>
                                    <div style="position: absolute; top: 28%; width: 97%; left: 1%; text-align: center; font-family:Cambria, Georgia, serif; font-size: 16px; height: 70%; vertical-align: top;" >
                                        <div id="ixName" >
                                            <h:outputLabel value="#{patientReportController.currentPatientReport.patientInvestigation.investigation.printName}" 
                                                           style="font-weight: bold;font-size: 18px!important; "/>
                                        </div>
                                        <div id="labelsAndValues" style="left:5%; width: 90%; display: inline-block; vertical-align: top; " >
                                            <div style="vertical-align: top; width: 100%; padding: 1px;margin: auto;display: inline-block;">
                                                <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                                    <h:panelGroup style="display: inline-block; clear: left; float: left; width: 100%; vertical-align: top;" layout="block"  rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false and prv.lobValue ne '' and prv.lobValue ne null and prv.investigationItem.riTop lt 50 }" >
                                                        <div style="display: inline-block; float: left; width: 1%; clear: left; " ></div>
                                                        <div style="display: inline-block; top: 0px; float: left; width: 20%; text-align: left; padding-top: 2%; padding-bottom: 1%; ">
                                                            <h:outputLabel value="#{prv.investigationItem.name}"   escape="false"/>
                                                        </div>
                                                        <div style="display: inline-block; float: left; width: 3%; " ></div>
                                                        <div style="display: inline-block; text-align: left; float:left; width: 60%; padding-top: 2%; padding-bottom: 1%; ">
                                                            <h:outputLabel value="#{fn:replace(prv.lobValue,'\\n','&lt;br/&gt;')}"   escape="false"   />
                                                        </div>
                                                    </h:panelGroup>
                                                </ui:repeat>
                                            </div>

                                            <div style="vertical-align: top; text-align: left;  padding-top: 3%; padding-bottom: 2%; clear: left;">
                                                <h:outputLabel value="Antibiotic Sensitivity Test" 
                                                               rendered="#{patientReportController.currentPatientReport.transHasAbst}"
                                                               style="font-size: 120%; font-weight: bold; padding-left: 18px;"></h:outputLabel>
                                            </div>
                                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" 
                                                        var="prv" >
                                                <h:panelGroup 
                                                    rendered="#{prv.investigationItem.ixItemType eq 'Antibiotic' and prv.investigationItem.retired eq false and prv.strValue ne '' and prv.strValue ne null  }" >
                                                    <div style="float: left;width: 5%; clear: left;" ></div>
                                                    <div style=" float: left; text-align: left; width: 40%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                        <h:outputLabel value="#{prv.investigationItem.name}"  escape="false" />
                                                    </div>
                                                    <div style="float: left;width: 5%;  " ></div>
                                                    <div style=" text-align: left; float:left;width: 40%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                        <h:outputLabel value="#{prv.strValue}" escape="false" style="text-transform: uppercase;" />
                                                    </div>

                                                </h:panelGroup>
                                            </ui:repeat>
                                            <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                                                <h:panelGroup rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Memo' and prv.investigationItem.retired eq false and prv.lobValue ne '' and prv.lobValue ne null and prv.investigationItem.riTop gt 50 }" >
                                                    <div style="float: left;width: 5%; " ></div>
                                                    <div style=" float: left; text-align: left; width: 20%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                        <h:outputLabel value="#{prv.investigationItem.name}"  escape="false" />
                                                    </div>
                                                    <div style="float: left;width: 5%;  " ></div>
                                                    <div style=" text-align: left; float:left;width: 60%;padding-left: 1px; padding-right: 1px; padding-top: 5px; vertical-align: top;">
                                                        <h:outputLabel value="#{fn:replace(prv.lobValue,'\\n','&lt;br/&gt;')}"    escape="false" />
                                                    </div>
                                                </h:panelGroup>
                                            </ui:repeat>
                                        </div>
                                        <div style="clear: left;padding-top: 2%;">
                                            <h:outputLabel value="--- End of Report ---" style="font-size: 14px; font-weight: bold; "></h:outputLabel>
                                        </div>
                                    </div>
                                </div>
                            </h:panelGroup>

                        </h:panelGroup>




                    </h:form>
                </div>

                <h:panelGroup rendered="false" >
                    <table>
                        <tr>
                            <th>
                                ixItemType
                            </th>
                            <th>
                                ixItemValueType
                            </th>
                            <td>
                                <h:outputLabel value="name" escape="false" />
                            </td>
                            <td>
                                <h:outputLabel value="cssTop" escape="false" />
                            </td>
                            <td>
                                <h:outputLabel value="riTop" escape="false" />
                            </td>
                            <td>
                                <h:outputLabel value="cssLeft" escape="false" />
                            </td>
                            <td>
                                <h:outputLabel value="riLeft" escape="false" />
                            </td>
                        </tr>

                        <ui:repeat  value="#{patientReportController.currentPatientReport.patientReportItemValues}" var="prv" >
                            <tr>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.ixItemType}" escape="false" />
                                </td>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.ixItemValueType}" escape="false" />
                                </td>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.name}" escape="false" />
                                </td>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.cssTop}" escape="false" />
                                </td>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.riTop}" escape="false" />
                                </td>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.cssLeft}" escape="false" />
                                </td>
                                <td>
                                    <h:outputLabel value="#{prv.investigationItem.riLeft}" escape="false" />
                                </td>
                            </tr>
                            <div style="#{prv.investigationItem.cssStyle}; position:absolute;">
                                <h:outputLabel value="#{prv.strValue}" rendered="#{prv.investigationItem.ixItemType eq 'Value' and prv.investigationItem.ixItemValueType eq 'Varchar'}" escape="false" />
                            </div>
                        </ui:repeat>

                    </table>
                </h:panelGroup>


            </ui:define>



        </ui:composition>

    </body>
</html>
